package objbo.xmlparser.controls.action;

import org.eclipse.jface.action.Action;

import objbo.xmlparser.controls.ControlMain;
import objbo.xmlparser.model.bean.ElementBean;
import objbo.xmlparser.view.interfaces.ElementInterFace;
import objbo.xmlparser.view.interfaces.UIInterFace;
import objbo.xmlparser.view.ui.AttributeListUI;
import objbo.xmlparser.view.ui.ContentUI;



public class ContentModifyAction extends Action
{
	private UIInterFace uIInterFace = null;
	private ElementInterFace elementInterFace = null;
	private ContentUI ui = null;
	
	public ContentModifyAction(ElementInterFace elementInterFace, UIInterFace uIInterFace)
	{
		this.uIInterFace = uIInterFace;
		this.elementInterFace = elementInterFace;
	}
	
	public void setContentUI(ContentUI ui)
	{
		this.ui = ui;
	}
	
	
	@Override
	public void run()
	{
		Object[] data = ui.getData();
		
		
		
		ElementBean elementBean = (ElementBean) data[0];
		String contentData  = (String) data[1];
		
		
		
		if(elementBean == null || contentData == null )
		{return;}
		
		this.elementInterFace.modifyElementContent(elementBean, contentData);
		this.uIInterFace.setTabElementData(elementBean);
		//this.uIInterFace.refreshTreeUI();
		
	}
}
